<?php
/**
 * notes _list component view.
 *
 * @package    FinalsClub
 * @subpackage notes
 * @author     Colin Hom
 */
?>
<ul class="courses-list">	
	<?php foreach($notes_pager->getResults() as $note): ?>
	<li>
		<h3>
			Lecture <?php echo $note->getNumber() ?> - 
			<?php echo render_note_title_link($note) ?>
        </h3>
		<div class="details">
			<p class="related-users">
				<strong>Date: </strong>
				<?php echo $note->getUpdatedAt() ? $note->getUpdatedAt('M d, Y') : $note->getCreatedAt('M d, Y') ?>
			</p>
			<p class="related-users">
				<strong>Note Taker: </strong>
				<?php echo render_profile_link(UserPeer::retrieveByPk($note->getUserId())) ?>
			</p>
			<p><?php echo render_note_summary($note) ?></p>

			
			<?php include_component('ratings','show', array('obj'=>$note))?>

			<p>
				<?php if($sf_user->isGroupAdmin($note->getGroupId()) || $sf_user->isGroupContributor($note->getGroupId())): ?>
					<?php echo link_to('edit', 'notes/edit?id='.$note->getId())?>
					&nbsp;
					<?php if($note->getUser()->getId() == $sf_user->getId()): ?>
						<?php echo link_to('delete', 'notes/delete?id='.$note->getId())?>
					<?php endif ?>
				<?php endif ?>
			</p>
		</div>
	</li>
	<?php endforeach ?>
	<?php if($notes_pager->haveToPaginate()): ?>
		<li class="last">
			<p class="view-all" style="text-align: right;">
				<?php /* Temporary - So pagination pointers are consistent until ajax */
					$var_url = 'notes/index?'.(isset($course_id) ? "course_id=".$course_id : "" ).(isset($group_id) ? "&group_id=".$group_id : "");
					echo pager_navigation($notes_pager, url_for($var_url)); ?>
			</p>
		</li>
	<?php endif ?>
	</ul>